<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang='en'>
<head>
	<meta charset='utf-8' />
	<title>广溢信息技术有限公司</title>
	<meta content='' name='description' />
	<meta content='' name='author' />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- Bootstrap -->
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" >
    <link href="__PUBLIC__/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet" >

	<!--[if IE 7]>
		<link  href="__PUBLIC__/css/font-awesome-ie7.min.css" rel="stylesheet">
	<![endif]-->

	<!--[if lt IE 9]>
		<link type="text/css" href="__PUBLIC__/css/custom-theme/jquery.ui.1.9.2.ie.css"  rel="stylesheet" />
	<![endif]-->

	<link href="__PUBLIC__/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="__PUBLIC__/css/test.css" rel="stylesheet">
	<script src="__PUBLIC__/js/jquery.js"></script>

	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	<script src="__PUBLIC__/js/html5shiv.js"></script>
	<script src="__PUBLIC__/js/respond.min.js"></script>
	<![endif]-->
	<script type="text/javascript">
	var upload_url="<?php echo U('file/upload?module='.MODULE_NAME);?>";
	var del_url="<?php echo U('File/del');?>";
	var session_id="<?php echo session_id();?>";	
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?2a935166b0c9b73fef3c8bae58b95fe4";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
</script>
</head>
<body>
	<div class="shade"></div>
	<div class="row-fluid navbar visible-phone">
	<div class="row-fluid">
		<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
		<a data-toggle="collapse" data-target="#top_menu" class="right">
		<i class="brand icon-th-list"></i>
		</a>
	</div>
	<div class="col-lapse" id="top_menu">
		<ul class="nav nav-pills">
			<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
					<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
				</li><?php endforeach; endif; else: echo "" ;endif; ?>
		</ul>
	</div>
</div>
<div class="row-fluid navbar hidden-phone">
	<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
	<ul class="nav nav-pills">
		<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
				<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
			</li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>
	<aside>
		<span>
			<a href="<?php echo U('UserConfig/index');?>">设置</a>
		</span>
		<span>
			<a href="<?php echo U('profile/index');?>"><?php echo (session('user_name')); ?></a>
		</span>
		<span>
			<a href="<?php echo U('login/logout');?>">退出</a>
		</span>
		&nbsp;&nbsp;
	</aside>
</div>

	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span3 left_menu">
				<div class="visible-phone">
	<h4 class="btn no-border" data-toggle="collapse" data-target="#left_menu">		
			<?php echo ($top_menu_name); ?><i class="icon-angle-down"></i>
		</h4>
	<div class="col-lapse" id="left_menu"><?php echo ($html_left_menu); ?></div>
</div>
<div class="hidden-phone">
	<h4><?php echo ($top_menu_name); ?></h4>
	<div><?php echo ($html_left_menu); ?></div>
</div>
			</div>
			<div class="span9 content">
<script type="text/javascript">
		function add() {
			window.open("<?php echo U('add');?>", "_self");
		}
		function del(obj){
			if(confirm('确定要删除吗?')){
				id=$(obj).parent().parent().find("input.node").val();
				sendAjax("<?php echo U('del');?>","id="+id,function(data){
					$(obj).parent().parent().remove();
					alert(data.info);
				});	
			}
		}
		$(document).ready(function(){
			set_return_url();
			$("#dialog2").mouseleave(function() {
				$("#dialog2").hide();
			});

			$("li a.status").live("click",(function(){
				$("#dialog2").css("left", $(this).parents("span").offset().left);
				$("#dialog2").css("top", $(this).parents("span").offset().top);
				$("#dialog2").show();
				node=$(this).parents("li").find("input.node").val();
				$("#dialog2").attr("node",node);
			}))

			$("li").each(function(){
				$(this).css("background-color",schedule_bg($(this).find("input.priority").val()));	
			})
			$("a.up").click(function(){
				moveUp($(this));
			})
			$("a.down").click(function(){
				moveDown($(this));
			})
		})

		function moveUp(obj){
			var current=$(obj).parent().parent();  
			var prev=current.prev();			
			if(current.index()>1){
				current.insertBefore(prev);
				current.find("input.priority").val(prev.find("input.priority").val());
				current.css("background-color",schedule_bg(current.find("input.priority").val()));
			}
			set_sort();
		}

		function moveDown(obj){
			var current=$(obj).parent().parent();  
			var next=current.next();
			if(next){
				current.insertAfter(next);
				current.find("input.priority").val(next.find("input.priority").val());
				current.css("background-color",schedule_bg(next.find("input.priority").val()));
			}
			set_sort();
		}

		function mark_status(val){
			node=$("#dialog2").attr("node");
			if (node)
			{
				sendAjax("<?php echo U('mark_status');?>","id="+node+"&val="+val,function(data){
					alert(data.info);
					location.href=location.href;
				});
			}
		}

		function set_sort(){
			$("li.tbody").each(function(){
				$(this).find("input.sort").val($(this).index());
			})
			var vars = $("#form_data").serialize();
			sendAjax("<?php echo U('read');?>", vars);
		}
		
</script>
<div class="todo">
	<form method="post" action="" id="form_search" name="form_search">
		<div class="row-fluid title">
			<span>待办事项</span>
			<div class="input-append right">
				<input type="text"  onkeydown="key_search();" name="keyword" id="keyword">
				<a class="btn" onclick="btn_search();"> <i class="icon-search"></i>
				</a>
			</div>
		</div>
	</form>
	<form id="form_data" name="form_data" method='post'>
		<div class="row-fluid operate">
			<div class="left"></div>
			<div class="right">
				<a  onclick="add();" class="btn" >新建</a>
			</div>
		</div>
		<div>
			<div class="table span-12 last">
				<ul>
					<li class="thead">
						<span class="col-3 right">&nbsp;</span>
						<span class="col-3 right">&nbsp;</span>
						<span class="col-3 right">&nbsp;</span>
						<span class="col-6 right">状态</span>
						<span class="col-9 right">截至日期</span>
						<div class="auto autocut text-left">待办事项</div>
					</li>
					<?php if(is_array($list)): foreach($list as $key=>$vo): ?><li class="tbody" node="<?php echo ($vo["id"]); ?>">
							<input class="node" type="hidden" name="node[]" value="<?php echo ($vo["id"]); ?>">
							<input class="priority" type="hidden" name="priority[]" value="<?php echo ($vo["priority"]); ?>">
							<input class="sort" type="hidden" name="sort[]">
							<span class="col-3 right text-center">
								<a title="删除" class="del" onclick="del(this);">✕</a>
							</span>
							<span class="col-3 right text-center">
								<a title="低" class="down">&#9660;</a>
							</span>
							<span class="col-3 right text-center">
								<a title="高" class="up">&#9650;</a>
							</span>
							<span class="col-6 right text-center">
								<a class="status"><?php echo (todo_status($vo["status"])); ?></a>
							</span>
							<span class="col-9 right text-center"><?php echo ($vo["end_date"]); ?></span>
							<span class="auto">
								<a href="<?php echo U('edit?id='.$vo['id']);?>"><?php echo ($vo["name"]); ?></a>
							</span>
						</li><?php endforeach; endif; ?>
				</ul>
				<br>
				<ul>
					<li class="thead">
						<span class="col-3 right">&nbsp;</span>
						<span class="col-3 right">&nbsp;</span>
						<span class="col-3 right">&nbsp;</span>
						<span class="col-6 right">状态</span>
						<span class="col-9 right">完成日期</span>
						<div class="auto autocut text-left">已完成事项</div>
					</li>
					<?php if(is_array($list2)): foreach($list2 as $key=>$vo): ?><li class="tbody" node="<?php echo ($vo["id"]); ?>">
							<input class="node" type="hidden" name="node[]" value="<?php echo ($vo["id"]); ?>">
							<input class="priority" type="hidden" name="priority[]" value="<?php echo ($vo["priority"]); ?>">
							<input class="sort" type="hidden" name="sort[]">
							<span class="col-3 right text-center">
								<a title="删除" class="del" onclick="del(this);">✕</a>
							</span>
							<span class="col-3 right text-center">
								<a title="低" class="down">&#9660;</a>
							</span>
							<span class="col-3 right text-center">
								<a title="高" class="up">&#9650;</a>
							</span>
							<span class="col-6 right text-center">
								<a class="status"><?php echo (todo_status($vo["status"])); ?></a>
							</span>
							<span class="col-9 right text-center"><?php echo ($vo["end_date"]); ?></span>
							<span class="auto">
								<a href="<?php echo U('edit?id='.$vo['id']);?>"><?php echo ($vo["name"]); ?></a>
							</span>
						</li><?php endforeach; endif; ?>
				</ul>
			</div>
		</div>
	</form>
	<div id="dialog2" class="dropdown">
		<ul class="dropdown-menu">
			<li>
				<a onclick="mark_status(1);">尚未开始</a>
			</li>
			<li>
				<a onclick="mark_status(2);">正在进行</a>
			</li>
			<li>
				<a onclick="mark_status(3);">完成</a>
			</li>
		</ul>
	</div>
</div></div>
		</div>
	</div>
	<div class="msg popout"></div>
	<iframe src="<?php echo U('push/client');?>" class="push" id="push"></iframe>
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/js/jquery-ui-1.9.2.custom.min.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>